package chaoshi;

public class Market {
   private  String name;
     private  Product[] products;


//     生成方法

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Product[] getProducts() {
        return products;
    }

    public void setProducts(Product[] products) {
        this.products = products;
    }

    //卖货
     Product sell(Product p)
     {
         for(int i=0;i<products.length;i++)
         {
             if(products[i].getName()==p.getName)
             {
                 return  products[i];
             }
         }
         return null;
     }

}
